package com.caozhen.manage.response;

public class Response {
	
	public static final Integer SUCCESS_CODE = 1;
	public static final Integer ERROR_CODE = -1;
	public static final Integer TOKEN_ERROR_CODE = -2;
	
	private Integer code;//失败码
	private String message;//提示语句
	private Object result;//结果
	
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public Object getResult() {
		return result;
	}
	public void setResult(Object result) {
		this.result = result;
	}
	
	public static Response getSuccess(Object result,String msg) {
		Response r = new Response();
		r.code = SUCCESS_CODE;
		r.result = result;
		r.message = msg;
		return r;
	}
	
	public static Response getSuccess(Object result) {
		Response r = new Response();
		r.code = SUCCESS_CODE;
		r.result = result;
		return r;
	}
	
	public static Response getSuccess() {
		Response r = new Response();
		r.code = SUCCESS_CODE;
		r.result = null;
		r.message = "";
		return r;
	}
	
	public static Response getError(Integer errorCode,String message) {
		Response r = new Response();
		r.code = errorCode;
		r.message = message;
		r.result = "";
		return r;
	}
	 
	
	
}
